#!/usr/bin/env python

import os

f = open('booths.txt','r')
lines = f.readlines()
f.close()

boothPath = './Store/Booths'

rec = 0
words = []
for char in lines[0]:
    if char == '"' and rec == 0:
        rec = 1
        word = ''
    elif char == '"' and rec == 1:
        rec = 0
        words.append(word)

    if rec == 1 and char != '"':
        word += char
words.append('')
booths = []
j = 0
for i in range(0,len(words)):
    if j == 0:
        booth = words[i]
    elif j == 1:
        name = words[i]
    elif j == 2:
        pin = words[i]
    elif j == 3:
        address = words[i]
    elif j == 4:
        phone = words[i]
    elif j == 5:
        email = words[i]
    elif j == 6:
        misc = words[i]
        booths.append([booth,name,pin,address,phone,email,misc])
        j = -1
    j+=1

for booth in booths:
    num,name,pin,addy1,phone,email,misc = booth
    addy2 = ''
    addy3=''
    date = '1/1/2014'
    path = os.path.join(boothPath,num)
    os.mkdir(path)
    fname = os.path.join(path,'consignordata')
    f = open(fname,'w')
    for item in num, name, addy1, addy2, addy3, phone, email, date, '0.00,','0.00,','0.00,','0.00,','0.00,',:
        print num,name
        f.writelines(item+'\n')
    f.close()
    
        
